package deployr.core;

import static deployr.domain.NotFound.*;

import java.util.*;

import deployr.domain.*;

public class Select {

	private final List<IProject> projects;

	public Select(List<IProject> projects) {
		this.projects = projects;
	}

	public IProject firstMatch(String criteria) {
		for (final IProject project : projects) {
			if (new AppId(project.getProjectKey()).match(criteria)) return project;
		}

		return NotFoundProject;
	}

}
